<!--
描述：学校模块-课程类型
开发人：zhaohang
开发日期：2019年11月12日
-->
<template lang="pug">
  keep-alive
    kalix-table(bizKey="classSelect" title='课程筛选' ref="kalixTable"
    v-bind:tableFields="tableFields"
    v-bind:targetURL="classSelectURL"
    v-bind:bizDialog="classSelectDialog"
    v-bind:btnList="classSelectBtnList"
    v-bind:buttonPermissionPrefix="buttonPermissionPrefix"
    v-bind:toolbarBtnList="toolbarBtnList"
    v-bind:customRender="showMoocSelect"
    bizSearch="classSelectSearch")
</template>

<script type="text/ecmascript-6">
  import {classSelectURL, classSelectBtnPermissionPrefix} from '../../config.toml'
  import {classSelectConfigBtnList} from './config'
  import KalixTable from '../../../../../components/corelib/components/common/baseTable'

  export default {
    name: 'kalix-mplive-moocselect',
    components: {KalixTable},
    data() {
      return {
        classSelectURL: classSelectURL,
        tableFields: [
          {prop: 'selectName', label: '名称'},
          {prop: 'createBy', label: '创建人'},
          {prop: 'creationDate', label: '创建日期'},
          {prop: 'use', label: '是否启用'}
        ],
        classSelectDialog: [
          {id: 'add', dialog: 'ClassSelectAdd'},
          {id: 'edit', dialog: 'ClassSelectEdit'}
        ],
        classSelectBtnList: classSelectConfigBtnList,
        buttonPermissionPrefix: classSelectBtnPermissionPrefix,
        toolbarBtnList: [
          {id: 'add', isShow: true, title: '添加', isPermission: true}
        ]
      }
    },
    methods: {
      showMoocSelect(_data) {
        if (_data) {
          _data.forEach((e) => {
            if (e.use === false) {
              e.use = '不启用'
            }
            if (e.use === true) {
              e.use = '启用'
            }
            if (e.children) {
              this.showMoocSelect(e.children)
            }
          })
        }
      }
    }
  }
</script>

<style scoped lang="stylus">

</style>
